/*==============================================================*/
/* DBMS name:      ORACLE Version 11g                           */
/* Created on:     2013/8/6 19:06:51                            */
/*==============================================================*/


alter table BDDIC
   drop constraint FK_BDDIC_REFERENCE_BDDATATA;

drop table BDDATATABLE cascade constraints;

drop table BDDIC cascade constraints;

/*==============================================================*/
/* Table: BDDATATABLE                                           */
/*==============================================================*/
create table BDDATATABLE 
(
   TABLE_ID             NUMBER(18)           not null,
   TABLE_CODE           VARCHAR2(30),
   TABLE_NAME           VARCHAR2(30),
   DESCTRIPTION         VARCHAR2(300),
   constraint PK_BDDATATABLE primary key (TABLE_ID)
);

/*==============================================================*/
/* Table: BDDIC                                                 */
/*==============================================================*/
create table BDDIC 
(
   TABLE_ID             NUMBER(18)           not null,
   FIELD_CODE           VARCHAR2(30)         not null,
   FIELD_NAME           VARCHAR2(30)         not null,
   FIELD_TYPE           VARCHAR2(4)          not null,
   FIELD_NULL           VARCHAR2(30),
   FIELD_LONG           NUMBER(8),
   FIELD_KEY            VARCHAR2(4),
   FIELD_SHOWWIDTH      NUMBER(8),
   FIELD_SHOW           VARCHAR2(4),
   FIELD_POPWIN         VARCHAR2(30),
   FIELD_DATASOURCE     VARCHAR2(300),
   FIELD_AUTOCOL        VARCHAR2(4),
   FIELD_UNIQUE         VARCHAR2(4),
   FIELD_ID             VARCHAR2(4),
   TABLE_CODE           VARCHAR2(30),
   constraint PK_BDDIC primary key (TABLE_ID, FIELD_CODE)
);

alter table BDDIC
   add constraint FK_BDDIC_REFERENCE_BDDATATA foreign key (TABLE_ID)
      references BDDATATABLE (TABLE_ID);

